package com.teemor.im.remoting.netty;

import com.teemor.im.common.command.EventType;
import com.teemor.im.common.command.RequestType;
import com.teemor.im.common.command.RemoteCommand;
import com.teemor.im.common.util.IDCreator;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * 心跳处理handler
 * @ename zhoulk
 * @cname 周李科
 * @date 2020/6/29 14:17
 */
public class HeartBeatHandler extends SimpleChannelInboundHandler {

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        super.channelActive(ctx);
    }


    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {

    }

    RemoteCommand buildPingCommand() {
        RemoteCommand command = new RemoteCommand();
        command.setEventType(EventType.PING);
        command.setRequestType(RequestType.REQUEST);
        command.setSendTime(System.currentTimeMillis());
        command.setCommandId(IDCreator.createString());
        return command;
    }
}
